<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>培训管理</title>
    <link rel="stylesheet" href="/lib/layui/layui/css/layui.css">
    <link rel="stylesheet" href="/lib/zTreeStyle/zTreeStyle.css">
    <link rel="stylesheet" href="/lib/layui/layui/css/common.css">
    <link rel="stylesheet" href="/lib/layui/layui/css/eleTree.css">
    <script type="text/javascript" src="/lims/layui/global.js"></script>
    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.fileupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/ajaxupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <script src="/js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/layui/layui/layui.js"></script>
    <script type="text/javascript" src="/lib/layui/layui/global.js/"></script>
    <script src="/lib/layui/layui/js/baseCode/base.js?v=2019080918:09" type="text/javascript" charset="utf-8"></script>
    <style>
        html, body {
            width: 99%;
            height: 99%;
        }

        .layui-tab {
            height: 98%;
        }

        .layui-tab-content {
            height: calc(100% - 50px)
        }

        .layui-tab-item, .layui-card {
            height: 100%;
        }
    </style>

</head>
<body style="background-color: white;padding: 5px">
<div class="layui-tab">
    <ul class="layui-tab-title">
        <li class="layui-this">培训课程管理</li>
        <%--<li>报名信息</li>--%>
        <%--<li>签到信息</li>--%>
        <%--<li>评估查看</li>--%>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <div class="layui-card">
                <iframe style="width:100%;height:100%;" src="/course/index" frameborder="0"></iframe>
            </div>
        </div>
        <%--<div class="layui-tab-item">--%>
            <%--<div class="layui-form-item">--%>
                <%--<div class="layui-inline">--%>
                    <%--<label class="layui-form-label">人员名称</label>--%>
                    <%--<div class="layui-input-inline">--%>
                        <%--<input name="signupUser" class="layui-input" type="text" id="signupUser">--%>
                    <%--</div>--%>
                    <%--<label class="layui-form-label">课程名称</label>--%>
                    <%--<div class="layui-input-inline">--%>
                        <%--<input name="signupUser" class="layui-input" type="text" id="signupCourse"--%>
                               <%--autocomplete="off">--%>
                    <%--</div>--%>
                    <%--<button class="layui-btn" type="button" style="margin-left: 0px" id="searchButton2">搜索</button>--%>
                    <%--<button class="layui-btn import" type="button" download="/file/jdProject/报名信息模板.xlsx" url="/signUp/importSignUp" style="margin-left: 0px"  id="import0">导入</button>--%>
                <%--</div>--%>
            <%--</div>--%>

            <%--<table id="Settlement1" lay-filter="SettlementFilter1"></table>--%>

        <%--</div>--%>
        <%--<div class="layui-tab-item ">--%>
            <%--<div class="layui-card">--%>
                <%--<div class="layui-form-item">--%>
                    <%--<div class="layui-inline">--%>
                        <%--<label class="layui-form-label">人员名称</label>--%>
                        <%--<div class="layui-input-inline">--%>
                            <%--<input name="signinUser" class="layui-input" type="text" id="signinUser">--%>
                        <%--</div>--%>
                        <%--<label class="layui-form-label">课程名称</label>--%>
                        <%--<div class="layui-input-inline">--%>
                            <%--<input name="courseName" class="layui-input" type="text" id="search1"--%>
                                   <%--autocomplete="off" id="signinCourse">--%>
                        <%--</div>--%>
                        <%--<button class="layui-btn" type="button" id="searchButton1" style="margin-left: 0px;">搜索</button>--%>
                        <%--<button class="layui-btn import" type="button" download="/file/jdProject/签到信息模板.xlsx" url="/signIn/importSignIn" style="margin-left: 0px"  id="import">导入</button>--%>
                    <%--</div>--%>
                <%--</div>--%>
                <%--<table id="Settlement" lay-filter="SettlementFilter"></table>--%>
            <%--</div>--%>
        <%--</div>--%>

        <%--<div class="layui-tab-item">--%>
            <%--<div class="layui-form-item">--%>
                <%--<div class="layui-inline">--%>
                    <%--<label class="layui-form-label">人员名称</label>--%>
                    <%--<div class="layui-input-inline">--%>
                        <%--<input name="evaluateUser" class="layui-input" type="text" id="evaluateUser">--%>
                    <%--</div>--%>
                    <%--<label class="layui-form-label">课程名称</label>--%>
                    <%--<div class="layui-input-inline">--%>
                        <%--<input name="evaluateCourse" class="layui-input" type="text" id="evaluateCourse"--%>
                               <%--autocomplete="off">--%>
                    <%--</div>--%>
                    <%--<button class="layui-btn" type="button" style="    margin-left: 0px;" id="searchButton3">搜索</button>--%>
                    <%--<button class="layui-btn import" type="button" download="/file/jdProject/评估信息模板.xlsx" url="/evaluate/importEvaluate" style="margin-left:0px"  id="import2">导入</button>--%>
                <%--</div>--%>
            <%--</div>--%>
            <%--<table id="Settlement2" lay-filter="SettlementFilter2"></table>--%>

        <%--</div>--%>
    </div>
</div>
<div class="layui-card" id="opens" style="height:95%;display: none"><form class="layui-form" method="post" enctype="multipart/form-data" id="ajaxform" method="post" action="'+url+'">
    <div class="layui-form-item" style="margin-top: 10px;">

       <div class="layui-inline">
          <label class="layui-form-label" style="width:138px">导入模板下载:</label>
             <div class="layui-input-inline" style="margin-top: 7px;">
             <a href="'+download+'" style="color:#1E9FFF;">点击模板下载</a>
                </div>
        </div>
       </div>
   <div class="layui-form-item" style="margin-top: 10px;">

   <div class="layui-inline">
        <label class="layui-form-label" style="width:138px">选择文件:</label>
         <div class="layui-input-inline" style="">
          <input type="file" id="file" name="file" enctype="multipart/form-data"  >
            </div>
            </div>
   </div>

</form></div>

<script type="text/html" id="barOperation">



</script>
<script type="text/javascript">
    layui.use('element', function () {
        var $ = layui.jquery
            , element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块

        //触发事件
        var active = {
            tabAdd: function () {
                //新增一个Tab项
                element.tabAdd('demo', {
                    title: '新选项' + (Math.random() * 1000 | 0) //用于演示
                    , content: '内容' + (Math.random() * 1000 | 0)
                    , id: new Date().getTime() //实际使用一般是规定好的id，这里以时间戳模拟下
                })
            }
            , tabDelete: function (othis) {
                //删除指定Tab项
                element.tabDelete('demo', '44'); //删除：“商品管理”


                othis.addClass('layui-btn-disabled');
            }
            , tabChange: function () {
                //切换到指定Tab项
                element.tabChange('demo', '22'); //切换到：用户管理
            }
        };

        $('.site-demo-active').on('click', function () {
            var othis = $(this), type = othis.data('type');
            active[type] ? active[type].call(this, othis) : '';
        });

        //Hash地址的定位
        var layid = location.hash.replace(/^#test=/, '');
        element.tabChange('test', layid);

        element.on('tab(test)', function (elem) {
            location.hash = 'test=' + $(this).attr('lay-id');
        });

    });
    var first;
    var sencond;
    layui.use(['laydate', 'laypage', 'layer', 'table', 'carousel', 'upload', 'element', 'slider'], function () {
        var laydate = layui.laydate //日期
            , laypage = layui.laypage //分页
            , layer = layui.layer //弹层
            , table = layui.table //表格
            , carousel = layui.carousel //轮播
            , upload = layui.upload //上传
            , element = layui.element //元素操作
            , slider = layui.slider //滑块
        //执行一个 table 实例
        table1 = table.render({
            elem: '#Settlement1'
            , url: '/signUp/showAll' //数据接口
            , title: '报名信息表'
            , page: true //开启分页
            , toolbar: 'default ' //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            , cols: [[ //表头
                {field: 'signupId', title: 'ID', sort: true, fixed: 'left', hide: true}
                , {field: 'signupUser', title: '人员名称',}
                , {field: 'signupTime', title: '报名时间', sort: true,}
                , {field: 'signupCourse', title: '报名课程', sort: true}
            ]]
        });
        table2 = table.render({
            elem: '#Settlement'
            , url: '/signIn/showAll' //数据接口
            , title: '签到信息表'
            , page: true //开启分页
            , toolbar: 'default ' //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            , cols: [[ //表头
                {field: 'signinId', title: 'ID', sort: true, fixed: 'left', hide: true}
                , {field: 'signinUser', title: '人员名称',}
                , {field: 'signinTime', title: '签到时间', sort: true,}
                , {field: 'signinCourse', title: '签到课程', sort: true}
            ]]
        });
        table3 = table.render({
            elem: '#Settlement2'
            , url: '/evaluate/showAll' //数据接口
            , title: '签到信息表'
            , page: true //开启分页
            , toolbar: 'default ' //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            , cols: [[ //表头
                {field: 'evaluateId', title: 'ID', sort: true, fixed: 'left', hide: true}
                , {field: 'evaluateUser', title: '人员名称',}
                , {field: 'evaluateTime', title: '评估时间', sort: true,}
                , {field: 'evaluateCourse', title: '评估课程', sort: true}
                , {field: 'evaluateContent', title: '评估内容', sort: true}

            ]]
        });
        $("#searchButton1").click(function () {
            first = $("#signinUser").val();
            sencond = $("#signinCourse").val();
            table.reload('Settlement', {
                url: "/signIn/showAll",
                where: {
                    signinUser: first,
                    signinCourse: sencond
                }
            });


        })
        $("#searchButton2").click(function () {
            first = $("#signupUser").val();
            sencond = $("#signupCourse").val();
            table.reload('Settlement1', {
                url: "/signUp/showAll",
                where: {
                    signupUser: first,
                    signupCourse: sencond
                }
            });


        })
        $("#searchButton3").click(function () {
            first = $("#evaluateUser").val();
            sencond = $("#evaluateCourse").val();
            table.reload('Settlement2', {
                url: "/evaluate/showAll",
                where: {
                    evaluateUser: first,
                    evaluateCourse: sencond
                }
            });


        })


        $('.import').click(function() {
            var url = $(this).attr('url');
            var download = $(this).attr('download');

            layer.open({
                type: 1,
                skin: 'layui-layer-rim', //加上边框
                area: ['500px', '300px'], //宽高
                title: '导入',
                maxmin: true,
                btn: ['<div style="background:none;border:none;color:#fff" id="lay-submit">确定</div>', '取消'],
                content:jQuery("#opens"),
                yes:function(index){
                    if ($('input[name="file"]').val() == "") {
                        layer.msg("请选择要导入的文件！", {icon: 2});
                        return false;
                    }
                    var body = layer.getChildFrame('body', index);
                    var formData = new FormData();
                    formData.append("file",document.getElementById("file").files[0]);
                    $.ajax({
                        url:url,
                        dataType: 'json',
                        type: 'POST',
                        data: formData,
                        cache: false,
                        processData: false,  // 不处理数据
                        contentType: false,
                        success: function(r){
                            console.log(r);
                            if(r.flag == 0){
                                alert("导入成功！");
                                vm.reload();

                            }else{
                                alert(r.msg);
                            }
                        }
                    });
                    layer.close(index);

                }
            })
        })
    });


</script>

</body>


</html>